type Array2ArrayLike<T extends any[]> = Readonly<
  {
    [k in keyof T extends infer AllKey
      ? AllKey extends `${infer NumberKey extends number}`
        ? NumberKey
        : never
      : never]: T[k];
  } & { length: T['length'] }
>;

type Test1 = Array2ArrayLike<[1, 2, 3]>;
//     ^?
type Check = Omit<Test1, never> extends ArrayLike<number> ? 1 : 0;

/**
 * 作者：三毛丶
 * 链接：https://juejin.cn/post/6844903796997357582
 * 来源：稀土掘金
 * 著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。
 */
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
  k: infer I,
) => void
  ? I
  : never;

type Result = UnionToIntersection<(() => 1) | (() => 2)>; // string & number
//     ^?

export {};

type WriteableDeep<T extends Record<any, any>> = {
  -readonly [P in keyof T as string]-?: WriteableDeep<T[P]>;
};
